package com.orcamento.entity.report.subreport;

import java.util.List;

import com.orcamento.entity.Gain;
import com.orcamento.entity.Spent;
import com.orcamento.entity.enums.Month;
import com.orcamento.util.Money;

public class EventSubReport {

	private Month month;
	private Integer year;
	private List<Gain> gains;
	private List<Spent> spents;
	private Money balance = new Money();

	public EventSubReport(Month month, Integer year, List<Gain> gains, List<Spent> spents) {
		this.month = month;
		this.year = year;
		this.gains = gains;
		this.spents = spents;
		generateMoney();
	}

	private void generateMoney() {
		for(Gain gain : gains) {
			balance = balance.plus( gain.getValue() );
		}
		
		for(Spent spent : spents) {
			balance = balance.minus( spent.getValue() );
		}
	}

	public Month getMonth() {
		return month;
	}

	public Integer getYear() {
		return year;
	}

	public List<Gain> getGains() {
		return gains;
	}

	public List<Spent> getSpents() {
		return spents;
	}

	public Money getBalance() {
		return balance;
	}

}
